package com.example.demo.sensitive.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @ClassName ProcessStatusEnum
 * @Description 处理状态枚举
 * @Author System
 * @Date 2025/9/19
 **/
@Getter
@AllArgsConstructor
public enum ProcessStatusEnum {

    PENDING("pending", "待处理"),
    IGNORED("ignored", "已忽略"),
    CLEANED("cleaned", "已清理"),
    CONFIRMED("confirmed", "已确认");

    private final String code;
    private final String desc;

    /**
     * 根据code获取枚举
     */
    public static ProcessStatusEnum getByCode(String code) {
        for (ProcessStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return PENDING; // 默认返回待处理
    }

    /**
     * 判断是否已处理
     */
    public boolean isProcessed() {
        return this != PENDING;
    }
}
